MACHINES=(
    "feed-02.us-east-1.aws"
    "feed-02.eu-west-1.aws"
    "feed-02.ap-northeast-2.aws"
    "feed-05.ap-northeast-1.aws"
    "feed-05.cn-hongkong.aliyun"
    "feed-01.ap-northeast-1.aws.huobi"
)
if [ -z "$1" ]
then
echo "no date"
exit 1
fi

d=$1
type=""
if [ -n "$2" ] || [ "$2" = "fastfeed" ]; then
type=$2
elif [ "$2" = "rawfeed" ]; then
type=$2
else
echo "Wrong type. Please use fastfeed or rawfeed"
exit 1
fi

if [ ! -d "tmp_path/$d/" ]
then
mkdir -p tmp_path/$d/
fi

for m in "${MACHINES[@]}"
do
    if [ "$type" = "fastfeed" ]; then
        #fastfeed data
        ln -s "/remote/iosg/coin-2/feed_cache2/$m/$d/" "tmp_path/$d/$m"
    else
        #rawfeed data
        ln -s "/remote/iosg/coin/data/flow/$m/$d/" "tmp_path/$d/$m"
    fi
done

printf "%s\t%s\t%s\n" "$type" "$(find -L tmp_path/$d/ -type f | sort | wc -l)" "$(du -Ls -BG tmp_path/$d/)"

for m in "${MACHINES[@]}"
do
rm "tmp_path/$d/$m"
done

rmdir tmp_path/$d
rmdir tmp_path/